package com.situ.mall.common.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.situ.mall.common.entity.Member;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author JavaWizard
 * @since 2023-09-19
 */
@Mapper
public interface MemberMapper extends BaseMapper<Member> {

    /* 前端请求 */
    //查电话号码有没有被注册
    @Select("select * from member where tel = #{tel}")
    Member selectByTel(String tel);

    //注册保存
    @Insert("insert into member(avatar, background_pic, nickname, tel, password, status) values (#{avatar}, #{backgroundPic}, #{nickname}, #{tel}, #{password}, #{status})")
    void register(Member member);

    //token存入数据库
    @Insert("update member set token = #{token} where id = #{id}")
    void insertToken(String token, Integer id);

    //编辑个人资料
    void updateInfo(Member member);


    /* 后端操作 */
    //查询渲染表格
    List<Member> list(@Param("memberName") String memberName, @Param("tel") String tel);




}
